<template>
  <tbody>
    <tr v-for="(item, index) in goodList" :key="index">
      <td>
        <input
          type="checkbox"
          :checked="item.checked"
          @click="indexFn(index)"
        />
      </td>
      <td>{{ item.name }}</td>
      <td>{{ item.price }}</td>
      <td>
        <button @click="subtractFn(index)">-</button> {{ item.num }}
        <button @click="addFn(index)">+</button>
      </td>
      <td>{{ item.num * item.price }}</td>
      <td>
        <button @click="del(index)">删除</button>
      </td>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: ["goodList"],
  methods: {
    indexFn(index) {
      this.$emit("index11", index);
    },
    addFn(index) {
      this.$emit("addFn11", index);
    },
    subtractFn(index) {
      this.$emit("subtractFn11", index);
    },
    del(index) {
      this.$emit("del11", index);
    },
  },
};
</script>

<style>
</style>